import { useRef } from 'react'
import type { FormInstance } from '../interface'
import FormStore from './FormStore'

const useForm = () => {
	const formRef = useRef<FormInstance | null>()

	if (!formRef.current) {
		formRef.current = new FormStore().getDetail()
	}

	return [formRef.current]
}

export default useForm
